package com.middlegroup.pay.web.api;

import com.middlegroup.common.enums.ChannelCode;
import com.middlegroup.common.enums.ServiceType;
import com.middlegroup.common.exception.BusinessException;
import com.middlegroup.common.exception.ErrorMsg;
import com.middlegroup.common.model.ResponseEntity;
import com.middlegroup.common.model.TransRequest;
import com.middlegroup.common.model.TransResult;
import com.middlegroup.common.utils.MaskUtils;
import com.middlegroup.pay.bind.SessionMerchantCode;
import com.middlegroup.pay.bind.SessionMerchantId;
import com.middlegroup.pay.bind.SessionSubjectCode;
import com.middlegroup.pay.dto.RouterRequest;
import com.middlegroup.pay.dto.RouterResponse;
import com.middlegroup.pay.entity.CardBin;
import com.middlegroup.pay.entity.OutBills;
import com.middlegroup.pay.service.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.UUID;


/**
 * 交易api
 *
 * @author pc
 * @date 2019/1/4
 */
@RestController
public class DfController extends BaseController {

    @Resource
    private OutBillsService outBillsService;

    @Resource
    private MerchantSubjectChannelRouterService merchantSubjectChannelRouterService;

    @Resource
    private CardBinService cardBinService;

    @Resource
    private DfService dfService;

    @Value("${userinfo.encryptor.aeskey}")
    private String userInfoEncryptKey;


    @RequestMapping(value = "df")
    ResponseEntity df(@Valid TransRequest request, @SessionMerchantCode String merchantCode, @SessionSubjectCode String subjectCode) {
        request.setMerchantCode(merchantCode);
        request.setSubjectCode(subjectCode);
        TransResult transResult = dfService.df(request);
        return new ResponseEntity(ResponseEntity.STATUS_OK, transResult);
    }

}
